import os
import base64


def RenameFile(dir, filename):
    filename_bytes = filename.encode('utf-8')
    filename_bytes_base64 = base64.encodebytes(filename_bytes)

    filename_bytes_base64 = filename_bytes_base64[::-1][1:]  # 倒序
    new_filename = filename_bytes_base64.decode('utf-8') + '.liuxp'

    # print (new_filename)
    print(os.path.join(dir, filename))
    print(os.path.join(dir, new_filename))
    os.rename(os.path.join(dir, filename), os.path.join(dir, new_filename))


RenameFile("e:/test/", "cool.png")
